home *** CD-ROM | disk | FTP | other *** search
-
- /*
- File: UserLibrary.c
-
- Contains: graphics libraries - user library
-
- Written by: Cary Clark, Georgiann Delaney, Michael Fairman, Dave Good, Robert Johnson, Keith McGreggor, Oliver Steele, David Van Brink, Chris Yerga
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <1> 1/9/95 JD First checked in.
- */
-
- #include "GraphicsLibraries.h"
-
- void DisposeTagAt(gxTag *oldTag)
- {
- NilParamReturn(oldTag);
- if (*oldTag) {
- GXDisposeTag(*oldTag);
- *oldTag = nil;
- }
- }
-
- void AddShapeUser(gxShape source, const void *data, long length, long type)
- {
- gxTag tempItem;
-
- tempItem = GXNewTag(type, length, data);
- GXSetShapeTags(source, 0, 0, 0, 1, &tempItem);
- GXDisposeTag(tempItem);
- }
-
- long GetShapeUser(gxShape source, void *data, long *length, long requestedType, long *foundType, long index)
- {
- if( length )
- *length = 0;
-
- if( index )
- {
- gxTag tempItem;
-
- if( GXGetShapeTags(source, requestedType, index, 1, &tempItem) )
- {
- register long tempLength;
-
- tempLength = GXGetTag(tempItem, foundType, data);
- if( length )
- *length = tempLength;
- return index;
- }
-
- return 0;
- }
- else
- return GXGetShapeTags(source, requestedType, 1, gxSelectToEnd, nil);
- }
-
- void RemoveShapeUser(gxShape source, long type, long index)
- {
- register long count = 1;
-
- if( index == 0 ) /* remove all user items of the specified type */
- {
- count = gxSelectToEnd;
- index = 1;
- }
-
- GXSetShapeTags(source, type, index, count, 0, nil);
- }
-